var express = require('express');
var router = express.Router();
var {userModel,goodsModel} = require('../model/model');
/* GET home page. */
router.get('/user', async(req,res)=>{
  let data = await userModel.find();
  res.send({
    status:200,
    data:data
  });
})
router.post('/user',async(req,res)=>{
  let data = await userModel.create(req.body);
  res.send({
    status:200,
    data:data
  });
})
//商品
router.get('/goods', async(req,res)=>{
  let data = await goodsModel.find();
  res.send({
    status:200,
    data:data
  });
})

module.exports = router;
